package com.c5c7.util;

import java.sql.Connection;
import java.sql.DriverManager;

public class DBConnection {
    public String FilName;
    public int DBType;
    private Connection conn;
    private String MySqlDriver;
    private String MySqlURL;

    public DBConnection() {
        conn = null;
    }

    public Connection getConn() {

        DBType = 1;

        switch (DBType) {
            case 1:return (getConnToMySql());
            default:
                return null;
        }
    }

    private Connection getConnToMySql() {
        try {
            MySqlDriver = "com.mysql.jdbc.Driver";
            MySqlURL = "jdbc:mysql://localhost:3306/sky5?user=root&password=yu2003..&useUnicode=true";
            Class.forName(MySqlDriver).newInstance();
            conn = DriverManager.getConnection(MySqlURL);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return conn;
    }
}
